package com.example.leetdemo.finash;

public class Solution1252 {

    public static void main(String[] args) {

    }

    public int oddCells(int m, int n, int[][] indices) {
        int[] x = new int[m];
        int[] y = new int[n];
        for (int i = 0; i < indices.length; i++) {
            x[indices[i][0]]++;
            y[indices[i][1]]++;
        }
        int result = 0;
        int a = 0, b = 0;
        for (int i = 0; i < x.length; i++) {
            if (x[i] % 2 == 0) {
                a++;
            }
            if (x[i] % 2 == 1) {
                b++;
            }
        }
        for (int i = 0; i < y.length; i++) {
            if (y[i] % 2 == 0) {
                result += b;
            }
            if (y[i] % 2 == 1) {
                result += a;
            }
        }
        return result;
    }
}
